#pragma once

#include <vector>

namespace liba {
namespace lib3d {
namespace anim2d {

class FrameTimes
{
public:
	FrameTimes();
	// Amount is just a hint to avoid unnecessary allocations and memory copying.
	FrameTimes(size_t amount);
	FrameTimes(const FrameTimes& rhs);
	const FrameTimes& operator=(const FrameTimes& rhs);
	~FrameTimes();

	/** Adds new frame. time is how much does this frame appear on screen */
	void AddFrame(double time);

	double GetDuration() const { return duration; }
	size_t GetFrameNumber(double time) const;
	size_t GetFrameCount() const;
	double GetTime(size_t frameNumber) const;

	void Reset();
private:
	std::vector<double> timings;
	double duration;
};

} // namespace anim2d
} // namespace lib3d
} // namespace liba